#ifndef DATATYPE_H
#define DATATYPE_H

typedef  unsigned char UINT8;
typedef  unsigned int UINT32;


union Byte4
{
    UINT32 value;
    struct
    {
      UINT32  byte1 : 8;
      UINT32  byte2 : 8;
      UINT32  byte3 : 8;
      UINT32  byte4 : 8;
    }data;

};

struct Color {
    UINT8 m_R;
    UINT8 m_G;
    UINT8 m_B;
    UINT8 m_A;

    Color(
        UINT8 r = 0,
        UINT8 g = 0,
        UINT8 b = 0,
        UINT8 a = 255)
    {
        m_R = r;
        m_G = g;
        m_B = b;
        m_A = a;
    }

    Color(UINT32 rgba)
    {
        Byte4 temp;
        temp.value = rgba; //数据排列为0(B) 1(G) 2(R) 3(A)

        m_R = temp.data.byte3;
        m_G = temp.data.byte2;
        m_B = temp.data.byte1;
        m_A = temp.data.byte4;
    }
};



#endif // DATATYPE_H
